package com.example.administrator.rxjavarxandroid_retrofit.mvp.model;

import android.content.Context;

import com.example.administrator.rxjavarxandroid_retrofit.base.BaseModel;
import com.example.administrator.rxjavarxandroid_retrofit.http.api.CommonApi;
import com.example.administrator.rxjavarxandroid_retrofit.http.exception.rertyWhenNetWorkError;
import com.example.administrator.rxjavarxandroid_retrofit.http.transformer.SchedulersCompat;
import com.example.administrator.rxjavarxandroid_retrofit.mvp.contract.MainContract;
import com.example.administrator.rxjavarxandroid_retrofit.pojo.TableIp;

import rx.Observable;

/**
 * Created by chenboge on 2016/12/19.
 */
public class MainModel extends BaseModel implements MainContract.MainModel {

    public MainModel(Context context, CommonApi api) {
        super(context, api);
    }

    @Override
    public Observable<TableIp> getIpAddress(int page) {
        return mApi.userLogin(page).retryWhen(new rertyWhenNetWorkError()).compose(SchedulersCompat.applyIoSchedulers());
    }
}
